var t = require("../../../../@babel/runtime/helpers/defineProperty"), e = require("../../../../mycomponent/yz_pay/yz_pay"), a = getApp();

Page({
    behaviors: [ e ],
    data: {
        credit2: 0,
        buttons: [],
        typename: "",
        recharge: "",
        ordersn: "",
        money: "",
        pay_type: "",
        balanceLang: "余额"
    },
    onLoad: function(t) {},
    onReady: function() {},
    onShow: function() {
        this.getData(), this.getTitle();
    },
    onShareAppMessage: function() {},
    getData: function() {
        var t = this, e = a.getNetAddresss("plugin.auction.api.prepayment.withdraw.page");
        a._getNetWork({
            url: e,
            success: function(e) {
                var a = e.data;
                1 == a.result ? t.setData({
                    value: a.data.balance
                }) : wx.showToast({
                    title: a.msg,
                    icon: "none",
                    duration: 1e3
                });
            },
            fail: function(t) {
                console.log(t), wx.showToast({
                    title: t.msg,
                    icon: "none",
                    duration: 1e3
                });
            }
        });
    },
    getTitle: function() {
        var e = this, n = a.getNetAddresss("plugin.auction.api.member-prepayment.recharge");
        a._getNetWork({
            url: n,
            success: function(a) {
                var n = a.data;
                if (1 == n.result) {
                    e.setData({
                        buttons: n.data.buttons
                    });
                    for (var o = 0; o < e.data.buttons.length; o++) e.data.buttons[o] && e.setData(t({}, "buttons[" + o + "].btclass", e.btnclass(e.data.buttons[o].value)));
                } else wx.showToast({
                    title: n.msg,
                    icon: "none",
                    duration: 1e3
                });
            },
            fail: function(t) {
                console.log(t), wx.showToast({
                    title: t.msg,
                    icon: "none",
                    duration: 1e3
                });
            }
        });
    },
    moneyinp: function(t) {
        var e = t.detail.value;
        this.setData({
            money: e
        });
    },
    confirm: function(t) {
        var e = this, n = t.currentTarget.dataset.val;
        if (this.setData({
            money: parseFloat(this.data.money),
            pay_way: n
        }), this.data.money <= 0) wx.showToast({
            icon: "none",
            title: "金额不可低于0元",
            duration: 1500
        }); else {
            var o = a.getNetAddresss("plugin.auction.api.member-prepayment.check-recharge");
            o += "&client_type=2", o += "&app_type=wechat", o += "&pay_way=" + this.data.pay_way, 
            o += "&money=" + this.data.money, a._getNetWork({
                url: o,
                success: function(t) {
                    var a = t.data;
                    1 == a.result ? e.rechargePay(n, a, a.data.ordersn) : wx.showToast({
                        icon: "none",
                        title: a.msg,
                        duration: 1500
                    });
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        }
    }
});